package org.example.lotterysystem.common.exception;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.example.lotterysystem.common.errorcode.ErrorCode;


/**
 * @see org.example.lotterysystem.common.errorcode.ControllerErrorCode
 */



@NoArgsConstructor //为了序列化
@AllArgsConstructor
@Data
@EqualsAndHashCode(callSuper = true)
public class ControllerException extends RuntimeException {
    private Integer code; //异常码

    private String message; //异常信息

    public ControllerException(ErrorCode errorCode) {
        this.code = errorCode.getCode();
        this.message = errorCode.getMessage();
    }
}
